/**
 * 
 */
package nus.mtech.bill;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;


/**
 * @author Alvin Lee
 *
 */
public class Account implements Serializable {
	private static final long serialVersionUID = -4861903728356196018L;
	
	private String accountNo;
	private String customerId;
	private boolean activeStatus;
	private Date createDate;
	private Date closeDate;
	private double outstandingBalance = 0.0;
	private ArrayList<Payment> paymentList = new ArrayList<Payment>();
	
	public String getCustomerId() {
		return customerId;
	}

	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getCloseDate() {
		return closeDate;
	}

	public void setCloseDate(Date closeDate) {
		this.closeDate = closeDate;
	}

	public Account(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public boolean isActiveStatus() {
		return activeStatus;
	}

	public void setActiveStatus(boolean activeStatus) {
		this.activeStatus = activeStatus;
	}

	public double getOutstandingBalance() {
		return outstandingBalance;
	}

	public void setOutstandingBalance(double outstandingBalance) {
		this.outstandingBalance = outstandingBalance;
	}
	
	public void addPayment(Payment payment) {
		paymentList.add(payment);
		setOutstandingBalance(getOutstandingBalance() - payment.getPayAmount());
	}
	
	public List<Payment> getPaymentList() {
		return paymentList;
	}
}
